//
//  Config.swift
//  DYSwiftFramework
//
//  Created by huangdeyu on 2021/11/4.
//  Copyright © 2021 none. All rights reserved.
//

import Foundation

private let env_store_key = "env_store_key"

enum APP_ENV_ENUM:String {
    case online
    case test1
}

private var _env:APP_ENV_ENUM?

/// 当前app的运行环境，release模式下默认是 online, debug和docker模式下可以从缓存读
var APP_Environment:APP_ENV_ENUM {
    
    #if DEBUG || Docker
    if let e = _env {
        return e
    }
    let env = UserDefaults.standard.string(forKey: env_store_key)
    if let e = env,
       let env_enum = APP_ENV_ENUM.init(rawValue: e){
        return env_enum
    }
    return .test1
    #else
    print("当前运行环境是release模式")
    return .online
    #endif
}
